using System;
using System.Reflection;
using Microsoft.VisualStudio.Project;
using Microsoft.WowAddonStudio.Project;
using Microsoft.WowAddonStudio.Project.Automation;
using NUnit.Framework;

namespace WowProjectPackage.Tests
{
	/// <summary>
	/// 
	/// </summary>
	[TestFixture]
	public class OAWowProjectPropertiesTest : WowFileNodeTest
	{
		#region SetUp

		[SetUp]
		public override void SetUp()
		{
			base.SetUp();
		}

		#endregion

		#region TearDown

		[TearDown]
		public override void TearDown()
		{
			base.TearDown();
		}

		#endregion

		#region Tests

		/// <summary>
		/// Test_s the init OA wow project properties.
		/// </summary>
		[Test(Description = "")]
		public void Test_InitOAWowProjectProperties()
		{
			var constructor = typeof (OAWowProjectProperties).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null,
			                                                                 CallingConventions.HasThis,
			                                                                 new[] {typeof (NodeProperties)}, null);

			Assert.IsNotNull(constructor);

			SetProjectNodeProperties(projectNode);
			var fileNode = CreateLuaWowFileNode();
			var nodeProperties = new NodeProperties(fileNode);
			var properties = (OAWowProjectProperties) constructor.Invoke(BindingFlags.Instance | BindingFlags.NonPublic,
			                                                             null, new object[] {nodeProperties}, null);
			Assert.IsNotNull(properties);
			Assert.IsTrue(Enum.GetNames(typeof (GeneralPropertyPageTag)).Length <= properties.Count);

			foreach (string tag in Enum.GetNames(typeof (GeneralPropertyPageTag)))
			{
				Assert.IsTrue(properties.Properties.ContainsKey(tag));
			}
		}

		#endregion
	}
}